package edu.nf.takeoutdemo.mapper;

import com.github.pagehelper.Page;
import edu.nf.takeoutdemo.commons.annotation.AutoFill;
import edu.nf.takeoutdemo.commons.base.BaseMapper;
import edu.nf.takeoutdemo.commons.enumeration.OperationType;
import edu.nf.takeoutdemo.model.dto.SetmealPageQueryDTO;
import edu.nf.takeoutdemo.model.entity.Setmeal;
import edu.nf.takeoutdemo.model.vo.DishItemVO;
import edu.nf.takeoutdemo.model.vo.SetmealVO;

import java.util.List;
import java.util.Map;

/**
 *
 * @author zjl
 * @date 2025/10/25
 */
public interface SetmealMapper extends BaseMapper<Setmeal> {

    /**
     * 根据分类id查询套餐的数量
     *
     * @param categoryId
     * @return
     */
    Integer countByCategoryId(Long categoryId);

    @AutoFill(value= OperationType.INSERT)
    @Override
    void add(Setmeal setmeal);

    @AutoFill(value= OperationType.UPDATE)
    @Override
    void update(Setmeal setmeal);

    List<Setmeal> list(Setmeal setmeal);

    List<DishItemVO> getDishItemById(Long setmealId);

    /**
     * 分页查询
     * @param setmealPageQueryDTO
     * @return
     */
    Page<SetmealVO> pageQuery(SetmealPageQueryDTO setmealPageQueryDTO);

    /**
     * 批量删除套餐
     * @param ids
     */
    void deleteByIds(List<Long> ids);

    /**
     * 根据条件统计套餐数量
     * @param map
     * @return
     */
    Integer countByMap(Map<String,Object> map);

}
